<template>
  <el-dialog
    :title="title"
    :visible.sync="dialogFormVisible"
    width="800px"
    @close="close"
  >
    <el-descriptions
      ref="form"
      class="margin-top"
      title="愿望池详情"
      :column="2"
      border
      :model="form"
    >
      <el-descriptions-item>
        <template slot="label">
          <i class="el-icon-user"></i>
          真实姓名
        </template>
        <el-tag size="small">{{ form.userName }}</el-tag>
      </el-descriptions-item>
      <el-descriptions-item>
        <template slot="label">
          <i class="el-icon-phone-outline"></i>
          联系方式
        </template>
        <el-tag size="small">{{ form.contact }}</el-tag>
      </el-descriptions-item>
      <el-descriptions-item>
        <template slot="label">
          <i class="el-icon-c-scale-to-original"></i>
          详细地址
        </template>
        <el-tag size="small">{{ form.address }}</el-tag>
      </el-descriptions-item>
      <el-descriptions-item>
        <template slot="label">
          <i class="el-icon-office-building"></i>
          愿望名称
        </template>
        <el-tag size="small">{{ form.wish }}</el-tag>
      </el-descriptions-item>
      <el-descriptions-item>
        <template slot="label">
          <i class="el-icon-time"></i>
          描述
        </template>
        <el-tag size="small" type="info">{{ form.wishDesc }}</el-tag>
      </el-descriptions-item>
      <el-descriptions-item>
        <template slot="label">
          <i class="el-icon-time"></i>
          时间
        </template>
        <el-tag size="small">{{ form.wishTime }}</el-tag>
      </el-descriptions-item>
    </el-descriptions>
  </el-dialog>
</template>

<script>
  import { getWishInfo } from '@/api/wish'
  import { parseTime } from '@/utils/index'
  import _ from 'lodash'
  export default {
    name: 'WantDetails',
    data() {
      return {
        setStatus: {},
        form: {},
        title: '',
        dialogFormVisible: false,
      }
    },
    methods: {
      showEdit(row) {
        this.title = '愿望池'
        this.getWishDetail(row.wishId)
        this.dialogFormVisible = true
      },
      close() {
        this.dialogFormVisible = false
      },
      async getWishDetail(id) {
        const { data } = await getWishInfo(id)
        if (data.status == 0) {
          this.form = data.body
        } else {
          this.$baseMessage(data.message, 'error')
        }
      },
    },
  }
</script>
